<% layout('/layouts/default.html', {title: '拆而未尽表查询', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<ul class="nav nav-tabs bangPing-tabs">
				<li><a href="${ctx}/dataview/dcSupImportData/pageOne">${text('专项统计')}</a></li>
				<li ><a href="${ctx}/dataview/dcSupImportData/pageTwo">${text('数据分析')}</a></li>
				<li ><a href="${ctx}/dataview/dcSupImportData/pageThree">${text('各区对比')}</a></li>
				<% if(hasRole('data_board_import') || @UserUtils.getUser().getUserCode() == 'system'){ %>
					<li class="active"><a href="${ctx}/dataview/dcSupImportData/list">${text('数据导入')}</a></li>
				<% } %>
			</ul>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${dcSupImportData}" action="${ctx}/dataview/dcSupImportData/listData" method="post" class="form-inline"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">

				<div class="form-group">
					<label class="control-label">${text('日期')}：</label>
					<div class="control-inline">
						<#form:input path="c28" readonly="true" maxlength="10" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<a href="#" class="btn btn-default" id="btnImport"><i class="glyphicon glyphicon-import"></i> ${text('导入')}</a>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	sortable:false,
	sortableColumn: false,
	frozenCols: true,
	columnModel: [
		{header:'${text("序号")}', name:'c1', index:'a.c1', width:50, align:"center",frozen:true},
		{header:'${text("导入日期")}', name:'c28', index:'a.c28', width:120, align:"center",frozen:true},
		{header:'${text("区属")}', name:'c2', index:'a.c2', width:80, align:"left"},
		{header:'${text("年代")}', name:'c3', index:'a.c3', width:80, align:"left"},
		{header:'${text("项目名称")}', name:'c4', index:'a.c4', width:150, align:"left"},
		{header:'${text("土地性质")}', name:'c5', index:'a.c5', width:100, align:"left"},
		{header:'${text("项目总户数")}', name:'c6', index:'a.c6', width:120, align:"center"},
		{header:'${text("“拆而不净”任务户数")}', name:'c7', index:'a.c7', width:150, align:"center"},
		{header:'${text("当天完成户数")}', name:'c8', index:'a.c8', width:150, align:"center"},
		{header:'${text("截至所选日期实际已完成户数")}', name:'c9', index:'a.c9', width:200, align:"center"},
		{header:'${text("截至所选日期实际未完成户数")}', name:'c10', index:'a.c10', width:200, align:"center"},
		{header:'${text("当天实际完成户名和编号")}', name:'c11', index:'a.c11', width:170, align:"left"},
		{header:'${text("备注")}', name:'c12', index:'a.c12', width:150, align:"left"},
		{header:'${text("市征收处核实净地情况")}', name:'c13', index:'a.c13', width:150, align:"left"},
		{header:'${text("资金保障情况")}', name:'c14', index:'a.c14', width:150, align:"left"},
		{header:'${text("项目进场情况")}', name:'c15', index:'a.c15', width:150, align:"center"},
		{header:'${text("(上月)截至所选日期未完成户数")}', name:'c16', index:'a.c16', width:210, align:"center"},
		{header:'${text("(年底)截至所选日期未完成户数")}', name:'c17', index:'a.c17', width:210, align:"center"},
		{header:'${text("所属街道")}', name:'c18', index:'a.c18', width:150, align:"left"},
		{header:'${text("街道负责人")}', name:'c19', index:'a.c19', width:150, align:"left"},
		{header:'${text("职务")}', name:'c20', index:'a.c20', width:150, align:"left"},
		{header:'${text("联系方式")}', name:'c21', index:'a.c21', width:150, align:"left"},
		{header:'${text("报裁情况")}', name:'c22', index:'a.c22', width:150, align:"left"},
		{header:'${text("倒排计划完成时间")}', name:'c23', index:'a.c23', width:150, align:"left"},
		{header:'${text("项目存在问题及措施")}', name:'c24', index:'a.c24', width:150, align:"left"},
		{header:'${text("是否纳入“更新改造”")}', name:'c25', index:'a.c25', width:150, align:"left"},
		{header:'${text("“更新改造”保留户数")}', name:'c26', index:'a.c26', width:150, align:"center"},
		{header:'${text("“更新改造”工程进度")}', name:'c27', index:'a.c27', width:150, align:"left"},
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});

// 导入
$('#btnImport').click(function(){
	let selectDate = $('#c28').val();
	js.layer.open({
		type: 1,
		area: ['400px'],
		title: '${text("导入数据")}',
		resize: false,
		scrollbar: true,
		shadeClose: false,
		content: js.template('importTpl'),
		success: function(layero, index){
			layero.find('input[type="checkbox"]').iCheck();
			layero.find('#c28').val(selectDate);
		},
		btn: ['<i class="fa fa-check"></i> ${text("导入")}',
			'<i class="fa fa-remove"></i> ${text("关闭")}'],
		btn1: function(index, layero){
			var form = {
				inputForm: layero.find('#inputForm'),
				file: layero.find('#file').val()
			};
			if(!selectDate){
				js.showMessage("${text('请选择日期')}", null, 'warning');
				return false;
			}
			if (form.file == '' || (!js.endWith(form.file, '.xls') && !js.endWith(form.file, '.xlsx'))){
				js.showMessage("${text('文件不正确，请选择后缀为“xls”或“xlsx”的文件。')}", null, 'warning');
				return false;
			}
			js.ajaxSubmitForm(form.inputForm, function(data){
				js.showMessage(data.message);
				if(data.result == Global.TRUE){
					js.layer.closeAll();
				}
				page();
			}, "json");
			return true;
		}
	});
});
</script>

<script id="importTpl" type="text/template">//<!--

<form id="inputForm" action="${ctx}/dataview/dcSupImportData/importData" method="post" enctype="multipart/form-data"
	class="form-horizontal mt20 mb10" style="overflow:auto;max-height:200px;">
	<div class="row">
		<div class="col-xs-12 col-xs-offset-1">
			<input type="file" id="file" name="file" class="form-file"/>
			<font color="red" class="pull-left mt10">
			${text('提示：选择日期后导入会覆盖之前相对应日期的数据')}
			</font>
			<input type="date" id="c28" name="c28" style="display:none;">
			<div class="mt10 pt5">
				<a href="${ctxStatic}/拆而未尽导入模板.xlsx" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> ${text('下载模板')}</a>
			</div>
			<font color="red" class="pull-left mt10">
				${text('提示：仅允许导入“xls”或“xlsx”格式文件！')}
			</font>
		</div>
	</div>
</form>
//--></script>